Skip to content

refactor: use macros to register the subscription APIs#5782

Merged
akaladarshi merged 4 commits intoelmattic/eth-subscribefrom
akaladarshi/add-pending-tx-eth-subscribe
Jul 29, 2025
Merged

refactor: use macros to register the subscription APIs#5782
akaladarshi merged 4 commits intoelmattic/eth-subscribefrom
akaladarshi/add-pending-tx-eth-subscribe

Conversation

@akaladarshi
Copy link
Copy Markdown
Collaborator

@akaladarshi akaladarshi commented Jun 25, 2025

Summary of changes

Changes introduced in this pull request:

  • Refactors the PR
  • Use jsonrpsee macros to register the eth subscribe and unsubscribe API's

Reference issue to close (if applicable)

Closes

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

@akaladarshi akaladarshi force-pushed the akaladarshi/add-pending-tx-eth-subscribe branch from 6163337 to 4688372 Compare June 25, 2025 18:06
@akaladarshi akaladarshi force-pushed the akaladarshi/add-pending-tx-eth-subscribe branch from 4688372 to c33fd45 Compare July 18, 2025 16:00
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 18, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch akaladarshi/add-pending-tx-eth-subscribe

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@akaladarshi akaladarshi marked this pull request as ready for review July 29, 2025 09:13
@akaladarshi akaladarshi requested a review from a team as a code owner July 29, 2025 09:13
@akaladarshi akaladarshi requested review from elmattic and hanabi1224 and removed request for a team July 29, 2025 09:13
@akaladarshi akaladarshi changed the title feat: added pending transaction support for eth subscribe API refactor: use macros to register the subscription APIs Jul 29, 2025
@akaladarshi akaladarshi requested a review from LesnyRumcajs July 29, 2025 09:16
Comment thread src/rpc/methods/eth/pubsub.rs Outdated
Comment on lines +99 to +106
// TODO(akaladarshi): https://github.com/ChainSafe/forest/pull/5782
return Err(SubscriptionError::from(
jsonrpsee::types::ErrorObjectOwned::owned(
jsonrpsee::types::error::METHOD_NOT_FOUND_CODE,
"pendingTransactions subscription not yet implemented",
None::<()>,
),
));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it reference the right issue? Seems to be referencing the same PR.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the reference from here, since there is no specific issue for it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Comment thread src/rpc/methods/eth/pubsub_trait.rs Outdated
) -> jsonrpsee::core::SubscriptionResult;
}

// Keep the existing types but make them more structured
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leftover from ai?

Suggested change
// Keep the existing types but make them more structured

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

Copy link
Copy Markdown
Member

@LesnyRumcajs LesnyRumcajs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the subscription methods still present in the openrpc spec after these changes?

Comment thread src/rpc/mod.rs Outdated
let eth_pubsub = EthPubSub::new(state.clone());
module
.merge(eth_pubsub.into_rpc())
.expect("Could not merge eth pubsub module");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove expect here and propagate the error, like for the fil pubsub module.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored.

@elmattic
Copy link
Copy Markdown
Contributor

It's not clear based on your branch name, if this PR brings support of pendingTransactions event type.

@akaladarshi akaladarshi merged commit 065b89f into elmattic/eth-subscribe Jul 29, 2025
4 checks passed
@akaladarshi akaladarshi deleted the akaladarshi/add-pending-tx-eth-subscribe branch July 29, 2025 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants